//
//  CollectTableViewCell.m
//  markmap
//
//  Created by 甘世清 on 2024/4/8.
//

#import "CollectTableViewCell.h"

@implementation CollectTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)SQ_Style:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    UIView * bgView = [[UIView alloc]init];
    bgView.backgroundColor = SQHexColor(@"#333333", 0.4);
    bgView.layer.cornerRadius = 12;
    bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(4, 12, 4, 12));
    }];
    
    [bgView addSubview:self.topLabel];
    [self.topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(bgView).offset(14);
        make.height.mas_equalTo(22);
    }];
    [self.contentView addSubview:self.timeLabel];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bgView).offset(12);
        make.top.equalTo(self.topLabel.mas_bottom).offset(2);
        make.height.mas_equalTo(18);
    }];
    [self.contentView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.timeLabel.mas_bottom).offset(7);
        make.left.equalTo(bgView).offset(12);
        make.right.equalTo(bgView.mas_right).offset(-12);
    }];
   
    [self.contentView addSubview:self.collectBtn];
    [self.collectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(38);
        make.top.equalTo(bgView);
        make.right.equalTo(bgView.mas_right);
    }];
    self.FS_cellBottomView = self.messageLabel;
   
}
- (void)setModel:(PointModel *)model{
    self.topLabel.text = model.title;
    self.timeLabel.text = model.createTime;
    self.messageLabel.text =model.remark;
}
 

- (UILabel *)topLabel{
    if (!_topLabel) {
        _topLabel = [[UILabel alloc]init];
        _topLabel.font = FONT_MEDIUM(16);
        _topLabel.textColor = UIColor.whiteColor;
        _topLabel.backgroundColor = UIColor.clearColor;
    }
    return _topLabel;
}
- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_REGULAR(14);
        _messageLabel.textColor = SQColor(@"#909090");
        _messageLabel.backgroundColor = UIColor.clearColor;
        _messageLabel.numberOfLines = 0;
    }
    return _messageLabel;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = FONT_REGULAR(13);
        _timeLabel.textColor = SQColor(@"#909090");
        _timeLabel.backgroundColor = UIColor.clearColor;
    }
    return _timeLabel;
}
- (SQCustomButton *)collectBtn{
    if (!_collectBtn) {
        _collectBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(24, 24) midmargin:0];
        _collectBtn.image = SQGetImage(@"yishoucang");
        _collectBtn.backgroundColor = UIColor.clearColor;
    }
    return _collectBtn;
}
@end
